<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { goodsInDetailApi } from '@/apis/goods.js'
import SubmitBtn from '@/components/SubmitBtn.vue'

const formData = ref({
  batch: "", // 批次
  batchno: "", // 批次号
  boardrule: "", // 码板规则
  goodscode: "", // 物料编码
  goodsname: "", //物料名称
  ifnew: "Y", // 是否新品
  memo: "", // 备注
  weight: "", // 毛重
  actualnum: "", // 实发数量
  operrequire: "", //操作要求
  packheight: "", // 包装高
  packlength: "", // 包装长
  packweight: "", // 包装重量
  packwidth: "", // 包装宽
  unit: "", //单位
})
// 是否新品单选框
const ifnewList = ref([
  { name: '是', value: 'Y' },
  { name: '否', value: 'N' }
])

onLoad(async options => {
  if (options?.id) {
    const res = await goodsInDetailApi(options.id)
    formData.value = { ...res.data }
  }
})

const confing = {
  api: '/logistics/inorderdetail',
  requiredFields: [{
    key: 'goodscode',
    name: '物料编码',
  }, {
    key: 'goodsname',
    name: '物料名称',
  },
  ]
}
</script>

<template>
  <view class="carinfo page_container">
    <view class="content">
      <u-form :model="formData" label-width="150">
        <u-form-item label="物料编码:" required>
          <u-input disabled v-model="formData.goodscode" placeholder="请输入物料编码" />
        </u-form-item>
        <u-form-item label="物料名称:" required>
          <u-input disabled v-model="formData.goodsname" type="textarea" placeholder="请输入物料名称" />
        </u-form-item>
        <u-form-item label="批次:">
          <u-input disabled v-model="formData.batch" placeholder="请输入批次" />
        </u-form-item>
        <u-form-item label="批次号:">
          <u-input disabled v-model="formData.batchno" placeholder="请输入批次号" />
        </u-form-item>
        <u-form-item label="单位:">
          <u-input disabled v-model="formData.unit" placeholder="请输入单位" />
        </u-form-item>
        <u-form-item label="实发数量:">
          <u-input disabled v-model="formData.actualnum" placeholder="请输入实发数量" />
        </u-form-item>
        <u-form-item label="毛重:">
          <u-input disabled v-model="formData.weight" placeholder="请输入毛重" />
        </u-form-item>
        <u-form-item label="是否新品:">
          <u-radio-group disabled v-model="formData.ifnew">
            <u-radio v-for="item in ifnewList" :key="item.value" :name="item.value">
              {{ item.name }}
            </u-radio>
          </u-radio-group>
        </u-form-item>
        <u-form-item label="包装长:">
          <u-input disabled v-model="formData.packlength" placeholder="请输入包装长" />
        </u-form-item>
        <u-form-item label="包装宽:">
          <u-input disabled v-model="formData.packwidth" placeholder="请输入包装宽" />
        </u-form-item>
        <u-form-item label="包装高:">
          <u-input disabled v-model="formData.packheight" placeholder="请输入包装高" />
        </u-form-item>
        <u-form-item label="包装重量:">
          <u-input disabled v-model="formData.packweight" placeholder="请输入包装重" />
        </u-form-item>
        <u-form-item label="码板规则:">
          <u-input disabled v-model="formData.boardrule" type="textarea" placeholder="请输入码板规则" />
        </u-form-item>
        <u-form-item label="操作要求:">
          <u-input disabled v-model="formData.operrequire" type="textarea" placeholder="请输入操作要求" />
        </u-form-item>
        <u-form-item label="备注:">
          <u-input disabled v-model="formData.memo" type="textarea" placeholder="请输入备注" />
        </u-form-item>
      </u-form>
    </view>
    <!-- <SubmitBtn v-bind="confing" :formData="formData" /> -->
  </view>
</template>

<style lang="scss" scoped>
.carinfo {
  min-height: 100vh;
  background: #f5f5f5;
  padding-top: 20rpx;
  padding-bottom: 30rpx;

  .content {
    background: #fff !important;
    border-radius: 20rpx;
    padding: 0 40rpx;
    margin-bottom: 20rpx;
  }
}

::v-deep .uicon-plus {
  margin-top: 4rpx;
}

.more_list {
  width: 170rpx;
  padding-top: 30rpx;

  view {
    padding-bottom: 30rpx;
  }
}
</style>